import '@/lib/init-runtime' // 因为这一行必须在整个 app 最前面运行，所以 start-app 模块也应该在最前面加载

import config, { loadExternalConfig } from '@/config'
import { renderApp } from '@/lib/render-app'
import { setPageTitle, setFavicon } from '@/lib/title'
import { initServices } from '@/services'

export async function startApp(App: () => JSX.Element | null) {
  await loadExternalConfig()

  setPageTitle(config.PRODUCT_NAME)
  setFavicon(config.FAVICON_URL)

  initServices()
  renderApp(App)
}
